<template>
  <view class="list">
    <u-list
      v-if="orderList.length !== 0"
      height="100vh"
      @scrolltolower="getMore"
    >
      <u-list-item v-for="item in orderList" :key="item.id">
        <view class="item" @click="() => handleClick(item)">
          <view class="line">
            <view class="title">{{ item.subject }}</view>
            <view class="time">{{
              $u.timeFormat(item.updateDate, "yyyy-mm-dd hh:MM")
            }}</view>
          </view>
          <view class="detail">查看详情</view>
        </view>
      </u-list-item>
    </u-list>
    <emptyList v-else></emptyList>
  </view>
</template>

<!-- 盘点单列表 -->
<script setup>
import emptyList from "@/components/empty/emptyList.vue";
import { useList } from "@/hooks/useList";
import { getShopNoticePage } from "@/api/home";

const getList = async (item) => {
  const res = await getShopNoticePage({
    ...item,
  });
  return res;
};
const { orderList, getMore } = useList(getList);
const handleClick = (item) => {
  uni.navigateTo({
    url: "/pages/infoPages/noticeBar/noticeDetail?id=" + item.id,
  });
};
</script>

<style lang="scss">
page {
  background-color: #f9f9f9;
}

.list {
  padding: 0 15px;

  .item {
    margin-top: 10px;
    padding: 10px 9px 10px 14px;
    background-color: #fff;
    box-shadow: 0px 3px 12px 0px rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    .line {
      display: flex;
      justify-content: space-between;
      margin-bottom: 12px;
      .title {
        font-size: 13px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #4b4e50;
        line-height: 19px;
        max-height: 230px;
      }
      .time {
        font-size: 10px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #a0a0a0;
        line-height: 14px;
      }
    }
    .detail {
      font-size: 12px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #a0a0a0;
      line-height: 17px;
    }
    &:last-child {
      margin-bottom: 10px;
    }
  }
}
</style>
